﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage< SDT.Admin.ViewModels.MailCategoryInputModel>" %>

<%@ Import Namespace="SDT.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Thêm mới Chuyên mục mail
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%if (ViewData["MessageInfo"] == null)
      { %>
    <% using (Html.BeginForm("create", "mailcategory", FormMethod.Post, new { id = "adminForm" }))
       {%>
    <%= Html.ValidationSummary(true)%>
    <fieldset>
        <legend>Thêm mới</legend><font color="red">(*)</font> là trường bắt buộc phải nhập.
        <table class="admintable">
            <tbody>
                <tr>
                    <td class="key">
                        Phân mục cha
                    </td>
                    <td>
                        <%=Html.DropDownListFor(m=>m.Category.ParentID, new SelectList(Model.Categories, "ID", "Name").ToList(), "-- Chọn phân mục cha--")%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tên phân mục (<font color="red">*</font>)
                    </td>
                    <td>
                        <%= Html.TextBoxFor(model => model.Category.Name, new { @class = "required", style="width:300px" })%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Trạng thái kích hoạt
                    </td>
                    <td>
                        <%=Html.RadioButtonFor(m=>m.Category.PubYN, true, Model.Category.PubYN == true ? new { @checked = "checked" } : null)%>
                        Kích hoạt
                        <%=Html.RadioButtonFor(m => m.Category.PubYN, false, Model.Category.PubYN == false ? new { @checked = "checked" } : null)%>
                        Không kích hoạt
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Thêm mới" />
                    </td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <% }
  } %>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate({
                rules: {
                    Priority: { required: true, number: true }
                },
                message: {
                    Priority: { required: "This field is required .!.", number: "Character must is number .!." }
                }
            });
        });

    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/mailcategory", "back") %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Thêm mới chuyên mục mail
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>
</asp:Content>
